const hiSmartLiteEx = require('../hiSmartLiteEx');
const setting = require('../util/settingHandler');

const giteeApi = {
  // 获取授权用户token
  getAccessToken(username, password, clientId, clientSecret, scope) {
    const data = {
      grant_type: 'password',
      username: username,
      password: password,
      client_id: clientId,
      client_secret: clientSecret,
      scope: scope
    };
    return hiSmartLiteEx.oldGiteeServiceCli.post('/oauth/token', data);
  },
  // 获取gitee登录用户信息
  getUserData(accessToken) {
    return hiSmartLiteEx.giteeServiceCli.get(`enterprises/users?access_token=${accessToken}`);
  }
};

module.exports = giteeApi;